local caches = require("optimize.cache")
local newt = require("newt")

---仿事务
---@param tab     table @数据表
---@param emt     any   @等同空
return function(tab, emt)
    local ret = caches[tab]
    if not ret then
        ret = newt()
        local mt = newt()
        mt.__empty = emt
        mt.__index = tab
        mt.__newindex = newt()
        setmetatable(ret, mt)
    end
    caches[tab] = ret
    return ret
end
